/*
 * LeftUkazatelPanel.java
 *
 * Created on 18. �erven 2007, 11:36
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package cz.possoft.client.chess.gui.panel;

import info.clearthought.layout.TableLayout;

import javax.swing.JLabel;
import javax.swing.JPanel;

import cz.possoft.generic.utils.GenericUtils;

/**
 *
 * @author mara
 */

// Trida levy ukazatel na sachovnici - cisla 1,2,3,4,...
public class LeftUkazatelPanel extends JPanel {
    
    private double chessSize[][] =
        {{15,10},
        {4,55,55,55,55,55,55,55,55,4}};
    
    // pole s hodnotama boku sachovnice - 8 , 7 , 6 ...
    private JLabel labels[] = {new JLabel("8"), new JLabel("7"), new JLabel("6"), new JLabel("5"), new JLabel("4"), new JLabel("3"), new JLabel("2"), new JLabel("1")};
        
    /** Creates a new instance of LeftUkazatelPanel */
    public LeftUkazatelPanel() {
        initContents();
    }
    
    public void initContents() {
        setLayout(new TableLayout(chessSize));
        for (int i = 0; i < 8 ; i++) {
        	add(labels[i], "1," + String.valueOf(i + 1));
        }          
    }
    
    // nastavi labely na sachovnici podle barvy hrace (otoceni sachovnice)
    public void setLabelsForColor(int color) {
          if (color == GenericUtils.COLOR_WHITE) {
              for (int i = 0; i < 8 ; i++) {
              	labels[i].setText(String.valueOf(8 - i));
              }              	  
          }
          else {
              for (int i = 0; i < 8 ; i++) {
                	labels[i].setText(String.valueOf(i + 1));
                }              	  
          }
    }
    
}
